<html>	
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<body>
<?php
if(isset($_POST["min"]) && isset($_POST["max"]))
{
	$max = $_POST["max"];
	$min = $_POST["min"];
	$sum = 0;
	$product = 1;
	$SOEN = 0;
	$SOON = 0;
	$i = $min;
	while($i <= $max)
	{
		$sum = $sum + $i;
		$product = $product * $i;
		if(($i % 2) == 0)
		{
			$SOEN++;
		}
		else
		{
			$SOON++;
		}
		$i++;		
	}
}
?>
<form id="form1"name="form1"method="post"action="TinhToanTrenDaySo.php">
	<table align="center">
		<tr>
			<td colspan="3"><span>WORK ON ARRAY OF NUMBER</span></td>

		</tr>


		<tr>
			<td><span>limit number of Array: </span></td>
			<td><span>start number:</span><label><input id="min"name="min"type="text"value="<?php
				if(isset($_POST["min"]))
				{
					echo $_POST["min"];
				}
			?>"/></label></td>
			<td><span>end number:</span><label><input id="max"name="max"type="text"value="<?php
				if(isset($_POST["max"]))
				{
					echo $_POST["max"];
				}
			?>"/></label></td>
		</tr>
		<tr>
			<td colspan="3" align="left"><span>result</span></td>

		</tr>

		<tr>
			<td><span>Sum of array: </span></td>
			<td colspan="2"><label><input id="sum" name="sum" type="text" value="<?php
				if(isset($_POST["sum"]))
				{
					echo $sum;
				}
			
			?>"/></label></td>
		
		</tr>
		
		<tr>
			<td><span>Product: </span></td>
			<td colspan="2"><label><input id="product"name="product"type="text"value="<?php
			if(isset($_POST["product"]))
			{
				echo $product;
			}
			?>"/></label></td>
		</tr>
		<tr>
			<td><span>Sum of even number: </span></td>
			<td colspan="2"><label><input id="SOEN"name="SOEN"type="text"value="<?php
			if(isset($_POST["SOEN"]))
			{
				echo $SOEN;
			}
			?>"/></label></td>
		</tr>
		<tr>
			<td><span>Sum of odd number: </span></td>
			<td colspan="2"><label><input id="SOON"name="SOON"type="text"value="<?php
			if(isset($_POST["SOON"]))
			{
				echo $SOON;
			}
			?>"/></label></td>
		</tr>
		<tr>
		<td colspan="3"><label><input id="submit"name="submit"type="submit"value="Compute"/></label></td>
		</tr>
	</table>


</form>

</body>


</html>